// Ofri Keidar 302933981 group 05

package controller;

import java.util.List;
import java.util.Map;

import model.database.DBException;

/**
 * Interface for possible transactions for Employee user
 */
public interface EmployeeController {

	public String getUserRealName(String userName) throws DBException;
	
	/**
	 * Creates a new account for customer matching given details.
	 * A new user-name record is created- default user name is customer's number.
	 * Cannot add customer if there is another customer record with given number
	 * @param number- new cutomer's number
	 * @param name- new cutomer's name
	 * @param userName- new customer's user-name
	 * @param address- new cutomer's address 
	 * @param creditCard- new cutomer's credit card number
	 * @return True if could create customer account, False if not
	 * @throws DBException if had problems connecting to database
	 */
	public boolean createCustomerAccount(int number, String name,
			String userName, String address, String creditCard)
			throws DBException;
	
	/**
	 * Adds a new product with given name and price.
	 * Cannot add product if there is another product record with given name
	 * @param name- new product's name
	 * @param price- new product's price
	 * @return True if could add product, False if not
	 * @throws DBException if had problems connecting to database
	 */
	public boolean addNewProduct(String name, double price) throws DBException;
	
	/**
	 * Updates price of product with given name to given price.
	 * If there is no product with given name, returns False and
	 * no price is updated
	 * @param name- product to update's name
	 * @param newPrice- new price to set
	 * @return True if could update price, False if not
	 * @throws DBException if had problems connecting database
	 */
	public boolean updateProductPrice(String name, double newPrice)
			throws DBException;
	
	/**
	 * Returns orders made by customer matching given number
	 * @param customerNumber- customer number whose orders to search
	 * @return list of all orders made by specified customer
	 * @throws DBException if had problems connecting to database
	 */
	public List<Map<String, String>> getOrders(int customerNumber)
			throws DBException;
	
	/**
	 * Sets given details for customer matching given number.
	 * If there is no customer with given number, False is returned
	 * and no details are updated
	 * @param number- number of customer to update
	 * @param name- new name for customer
	 * @param address- new address for customer
	 * @param creditCard- new credit card number for customer
	 * @return True if could update customer's details, False if not
	 * @throws DBException if had problems connecting database
	 */
	public boolean updateCustomerDetails(int number, String name,
			String address, String creditCard) throws DBException;
	
	/**
	 * Adds a new order with given details. 
	 * Order's date is set to be current date.
	 * Cannot add order if there is another order record with given number,
	 * or if there is no product matching given name or no customer matching
	 * given number
	 * @param productName- name of product to order
	 * @param amount- how many items to order
	 * @param customerNumber- number of ordering customer
	 * @return True if could add order, False if not
	 * @throws DBException if had problems connecting to database
	 */
	public boolean addNewOrder(String productName, int amount,
			int customerNumber) throws DBException;

	/**
	 * Returns customer with given number 
	 * @param number- customer number to search
	 * @return customer record matching given number
	 * @throws DBException if had problems connecting to database
	 */
	public Map<String, String> getCustomerDetails(int number)
			throws DBException;
	
	/**
	 * Returns all products
	 * @return list of all products in system
	 * @throws DBException if had problems connecting database 
	 */
	public List<Map<String, String>> getProducts() throws DBException;
	
	/**
	 * Returns price of the product with given name
	 * @param productName- product's name to check
	 * @return product's name
	 * @throws DBException if had problems connecting to database,
	 * 					   or if product does not exists, 
	 * 					   or value stored as product's price is not 
	 * 					   a numeric value 
	 */
	public double getProductPrice(String productName) throws DBException;
}